import { default as request, cloud } from '@/framework/utils/request'

export default ({
  add(data) {
    return request({
      url: `${cloud.business}/businessUser/userAdd`,
      method: 'POST',
      data,
      headers: {
        'Content-Type': 'application/json;charset=UTF-8'
      }
    })
  },
  edit(data) {
    return request({
      url: `${cloud.business}/businessUser/userEdit`,
      method: 'POST',
      data,
      headers: {
        'Content-Type': 'application/json;charset=UTF-8'
      }
    })
  },

  delete(data) {
    return request({
      url: `${cloud.business}/businessUser/del`,
      method: 'post',
      data
    })
  },
  changeStatus(data) {
    return request({
      url: `${cloud.business}/businessUser/changeStatus`,
      method: 'POST',
      data
    })
  },

  qryApp() {
    return request({
      url: `${cloud.permission}/role/getAppCodesByRoleIds`,
      method: 'GET',
      data
    })
  },
  qryAppAuthUser(data) {
    return request({
      url: `${cloud.business}/businessUser/qryAppAuthUser`,
      method: 'POST',
      data
    })
  },
  appAuthUser(data) {
    return request({
      url: `${cloud.business}/businessUser/appAuthUser`,
      method: 'POST',
      data
    })
  },
  qryAppByUser(userId) {
    return request({
      url: `${cloud.business}/businessUser/qryAppByUser?userId=${userId}`,
      method: 'GET'
    })
  },
  qryNoHasUserApp(userId) {
    return request({
      url: `${cloud.business}/businessUser/qryNoHasUserApp?userId=${userId}`,
      method: 'GET'
    })
  },
  updAppEnable(data) {
    return request({
      url: `${cloud.business}/businessUser/updAppEnable`,
      method: 'POST',
      data
    })
  },
  updAppAuth(data) {
    return request({
      url: `${cloud.business}/businessUser/updAppAuth`,
      method: 'POST',
      data
    })
  }
})
